import type { FieldRule } from '@arco-design/web-vue'

export const cacheSizeRule = (unit: number): FieldRule => {
  return {
    required: true,
    validator(value, callback) {
      const max = getOptionsLabel(diskOptions, unit, 'max')
      if (!value) {
        return callback('请输入磁盘空间')
      }
      if (value > Number(max)) {
        return callback(`最大值为${max}`)
      }
      return callback()
    }
  }
}
